import {defineStore} from "pinia";
import {ref} from "vue";

export const useApiStore = defineStore('api', () => {
    let routerDataList = ref([]);
    let apiSearchData = ref({});
    let addOrUpdateDialog = ref(false);
    let deleteApiDialog = ref(false);
    let apiRoleAuthorisationDialog = ref(false);

    function resetRouterDataList(info) {
        routerDataList.value = info;
    }

    function resetApiSearchData(info) {
        apiSearchData.value = info;
    }

    function resetAddOrUpdateDialog(flag) {
        addOrUpdateDialog.value = flag;
    }

    function resetDeleteApiDialog(flag) {
        deleteApiDialog.value = flag;
    }

    function resetApiRoleAuthorisationDialog(flag) {
        apiRoleAuthorisationDialog.value = flag;
    }

    return { routerDataList, resetRouterDataList, apiSearchData, resetApiSearchData, addOrUpdateDialog, resetAddOrUpdateDialog, deleteApiDialog, resetDeleteApiDialog,
        apiRoleAuthorisationDialog, resetApiRoleAuthorisationDialog }
})